package service;

import exception.SecKillException;
import model.Seckill;

import java.util.List;

/**
 * @Description:
 * @Author one world
 * @Date 2020/9/22 0022 14:05
 */
public interface SeckillService {
    /**
     * 分页查询秒杀信息
     * @param page
     * @param limit
     * @return List<Seckill>
     */
    public List<Seckill> findAll(int page,int limit);

    /**
     * 根据id查询秒杀信息
     * @param id
     * @return Seckill
     */
    public Seckill findById(Integer id);

    /**
     * 秒杀增加
     * @param seckill
     * @return boolean
     */
    public boolean add(Seckill seckill);

    /**
     * 秒杀修改
     * @param seckill
     * @return boolean
     */
    public boolean update(Seckill seckill);
    /**
     * 秒杀删除
     * @param id
     * @return boolean
     */
    public boolean del(Integer id);
    /**
     * 秒杀开启
     * @return boolean
     */
    public boolean startSecKill();

    /**
     * 秒杀进行
     * @param user_id
     * @param seckill_id
     * @param num
     * @throws SecKillException
     */
    public void secKill(Integer user_id,Integer seckill_id,Integer num) throws SecKillException;

    /**
     * 查询所有秒杀
     * @return List<Seckill>
     */
    public List<Seckill> findAll();

    /**
     * 查询秒杀的记录数
     * @return int
     */
    public int findCount();
}
